import React from 'react'
// import "./Image.css"

export default function Image() {
    let [img,setimg]=React.useState(["/img/1.jpg","/img/2.jpg","/img/3.jpg","/img/4.jpg"])
    let [index,setindex]=React.useState(1)
  let  left = ()=>{
    if(index>=img.length){
        setindex(1)

    }else{ setindex(++index)}
       
    }
    let  right = ()=>{
        if(index===1){
            setindex(img.length)
        }else{
            setindex(--index)
        }
        
    }
  return (
    <div>
        <div className='aa'>
        <img src={`/img/${index}.jpg`} alt="" />
        <div onClick={left} className='a1'>&lt;</div>
        <div onClick={right} className='a2'>&gt;</div>
       
        </div>
     
    </div>
  )
}
